package com.shawn.spring.boot.quartz.config;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

/**
 * @author shawn
 * @since 2020/8/25
 */
@Configuration
public class SchedulerConfig {

  @Bean
  public Scheduler scheduler(SchedulerFactoryBean schedulerFactory) throws SchedulerException {
    Scheduler scheduler = schedulerFactory.getScheduler();
    scheduler.start();
    return scheduler;
  }

}
